const domain1 = "https://api.it120.cc/small4/";
const domain2 = 'http://pay.aoaoxiong.top/'

function http({ domain=1, url, method = "GET", data = {}, header = {} }) {
  //导航栏显示loading
  wx.showLoading({
    title:'加载中..'
  })
  return new Promise((resolve, reject) => {
    wx.request({
      url: (domain==1?domain1:domain2) + url,
      header,
      method,
      data,
      success: (res) => {
        wx.hideLoading()     //隐藏导航栏loading效果
        resolve(res);
      },
      fail: (err) => {

        reject(err);
      },
    });
  });
}

export { http, domain1,domain2 };
